package com.xcx.demo.service;

import com.xcx.demo.dao.UserDAO;
import com.xcx.demo.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserService {
    @Autowired
    UserDAO userDAO;

    public boolean isExist(String openid){
        User user = userDAO.findByOid(openid);
        return null!=user;
    }

    public User findByOid(String openid){
        return userDAO.findByOid(openid);
    }

    public void save(String oid,String key){
        userDAO.save(new User(oid,key));
    }
}
